UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NtTAvwL0XQJFna9PXN9GujgULYY3mLid13Id/OJNko0=' 
WHERE 
  key_id = '1e3a2a970b8a68cc977b44407c13aa9c8d3cbcbf8696f4456ad2c27e5749a675' 
  AND (
    token = 'NtTAvwL0XQJFna9PXN9GujgULYY3mLid13Id/OJNko0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037