UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kVk5LgI1JNF0QkL8pYrpXryY2M0bpyeWvG+nqft7z5Q=' 
WHERE 
  key_id = 'd15d25f083e5d5470def43222085c0199b26d57831b04f84ca4c7fb2c2cde4d0' 
  AND (
    token = 'kVk5LgI1JNF0QkL8pYrpXryY2M0bpyeWvG+nqft7z5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00064