UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JqJUNtwc83mqge1PndKToq2g0r3VkisfoVV9+Men4YI=' 
WHERE 
  key_id = '86857559e5628284506bbd7a9c89d97e4de284243f27a0eef8f3febd7ee58188' 
  AND (
    token = 'JqJUNtwc83mqge1PndKToq2g0r3VkisfoVV9+Men4YI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015