UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f7um67xEfif0WQdIHCdfEFFTezs7BqX+y6EQ7VLtj5Q=' 
WHERE 
  key_id = '8256df21d0a56c081f5c18cb4557b2269acb87347c80a6aaf844e367d88d1f21' 
  AND (
    token = 'f7um67xEfif0WQdIHCdfEFFTezs7BqX+y6EQ7VLtj5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017