UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KgYOd3CoT3GbMh2SGWjoHBnatTJ4Qgr5Pbgt3dHDL3k=' 
WHERE 
  key_id = '657ef6dfe31a204b977bd6672199d1056e98e67fc41ac8845d8bb04d331a3518' 
  AND (
    token = 'KgYOd3CoT3GbMh2SGWjoHBnatTJ4Qgr5Pbgt3dHDL3k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052