UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iVZJdT5donFtBLX0KLvb9YMfwThzZzAm+00fmCql9Ko=' 
WHERE 
  key_id = '3bd9a101026d251a72af4f40edf7a85dcdd0d7841e5a3b0c0412f7ac754ae264' 
  AND (
    token = 'iVZJdT5donFtBLX0KLvb9YMfwThzZzAm+00fmCql9Ko=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036