UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yjkxwX2cgURZ/W1ZCRlWCs2yMT3/EM0BMHJ5F/zA9dY=' 
WHERE 
  key_id = 'b558902e76c305331d540073874c9c583a30137eb7b2a867cf55426ba5fda527' 
  AND (
    token = 'yjkxwX2cgURZ/W1ZCRlWCs2yMT3/EM0BMHJ5F/zA9dY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032