UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JFd8r3oDL0axAsmAz07bjsx8Qb3LmVE4c8QpC6g8roE=' 
WHERE 
  key_id = '9d3ab36c1f92890d705b98736d2e0b572094293b3552d2f93aef378cf6af2c93' 
  AND (
    token = 'JFd8r3oDL0axAsmAz07bjsx8Qb3LmVE4c8QpC6g8roE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038