UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MsI+cD6A/HesvqBFbmZpfa0RB/TQeCa7P3JLzfXIrlY=' 
WHERE 
  key_id = 'b45fa823d1d1ea62f769cdaad43c4270807b3f886ea4a27ca73aeb8b7d35ea97' 
  AND (
    token = 'MsI+cD6A/HesvqBFbmZpfa0RB/TQeCa7P3JLzfXIrlY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031