UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RYgLd9s2j8wHO35XMNyWTFr57fS9N4ed6SrVO/glPKo=' 
WHERE 
  key_id = '0f11295c513d021132aff45bd2b357548c52cd7f7e4fde6ad5b2020c3c8152d5' 
  AND (
    token = 'RYgLd9s2j8wHO35XMNyWTFr57fS9N4ed6SrVO/glPKo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039