UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0RSybZr2UUKnNY3RgUsZ2XzNtakN7tlamPwCxBFZF30=' 
WHERE 
  key_id = 'e5a1f512d2304f0ba1114d60b22942d68dc7a44c769c818fa190f40e284467f4' 
  AND (
    token = '0RSybZr2UUKnNY3RgUsZ2XzNtakN7tlamPwCxBFZF30=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024