UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9jiri+mtfs/RxL3Vb/FhVXm7h+odUQ7DSRAgbgOH4KY=' 
WHERE 
  key_id = '7d7795c6898057a425444f68d277d98f2031e1a2f1a49d34d70a07a28b7ac745' 
  AND (
    token = '9jiri+mtfs/RxL3Vb/FhVXm7h+odUQ7DSRAgbgOH4KY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033