UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IrZo/9yVtfG3D0Id+M3EEEDIfXorfPAI2Hv+aYBusjI=' 
WHERE 
  key_id = 'cdef2a337e792621a167d269e57585c5220585aaf0d5f10a476e76640a8bc16c' 
  AND (
    token = 'IrZo/9yVtfG3D0Id+M3EEEDIfXorfPAI2Hv+aYBusjI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029